// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#ifndef _STDAFX_H_
#define _STDAFX_H_

#define _USE_32BIT_TIME_T 1

#include <dlcom/cominc.h>
#include <log/ilogs.h>
#include <log/ilogdatabase.h>
#include <log/ilogfilter.h>

#include <comutiliy/base.h>

#define Rule_log				"logs"
#define Rule_Tables				"tables"
#define Rule_Table				"table"
#define Rule_Save				"save"
#define Rule_Op					"op"

#define Rule_Fields				"fields"
#define Rule_Fields_Name		"name"
#define Rule_Fields_Type		"type"
#define Rule_Fields_Size		"size"
#define Rule_Fields_Index		"index"

#define FIELD_TYPE_STRING		"string"
#define FIELD_TYPE_INT			"int"

#define FILED_TYPE_PRIMARYKEY	"PRIMARY KEY"
#define FILED_SQL_LEN			2048

#define	FILED_ID				"id"
#define FILED_S_TIME			"stm"
#define FILED_L_TIME			"ltm"


#define TABLE_OP_BASE			0
#define TABLE_OP_UPDATE			TABLE_OP_BASE + 1
#define TABLE_OP_INSERT			TABLE_OP_BASE + 2
#define TABLE_OP_REFRESH		TABLE_OP_BASE + 3


class LogData {

public:
	LogData(unsigned char* json, unsigned int ulen) {

		data = ALLOC_NEW unsigned char[ulen + 1]();
		if (data.m_p != NULL)
		{
			len = ulen;
			s_memcpy(data, json, ulen);
		}

	}
	~LogData() {

		data.dispose();
	}
	unsigned char* GetData() {

		return data.m_p;
	}
	unsigned long  GetLen() {

		return len;
	}
private:
	UCharArrayPtr data;
	unsigned long len;
};

typedef LogData* LogDataPtr;

typedef list<LogDataPtr>			TaskList;
typedef TaskList::iterator			TaskListIterator;

typedef	list<basic_tstring>			RuleList;
typedef RuleList::iterator			RuleListIterator;

typedef map<string, ITableStruct*>	MapTableStruct;
typedef MapTableStruct::iterator	MapTableStructIterator;

typedef	vector<FieldSturct>			Table;


#endif
